package com.xinqi.modules.prepare.common.convert;

import com.xinqi.common.mapstruct.CommonConvertConfig;
import com.xinqi.modules.prepare.common.dto.data.PrepareCoursewareData;
import com.xinqi.modules.prepare.common.dto.data.PrepareExamPaperData;
import com.xinqi.modules.prepare.common.dto.data.PrepareVideoData;
import com.xinqi.modules.prepare.common.dto.input.PrepareImportCoursewareData;
import com.xinqi.modules.prepare.common.dto.input.PrepareImportExamPaperData;
import com.xinqi.modules.prepare.common.dto.input.PrepareImportVideoData;
import com.xinqi.common.base.dto.QuestionBaseDTO;
import com.xinqi.modules.prepare.question.dto.QuestionImportDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * @author linkai
 * @date 2023/4/12
 */

@Mapper(config = CommonConvertConfig.class)
public abstract class PrepareImportConvert {

    public abstract PrepareCoursewareData convertCourseware(PrepareImportCoursewareData s);

    @Mapping(target = "files", expression = "java(com.xinqi.common.base.utils.json.JSON.parseList(s.getFileUrls(), com.xinqi.common.base.dto.CommonFileDTO.class))")
    public abstract PrepareVideoData convertVideo(PrepareImportVideoData s);

    public abstract PrepareExamPaperData convertExam(PrepareImportExamPaperData s);

    public abstract PrepareCoursewareData.PrepareCoursewarePartData convertCoursewarePart(PrepareImportCoursewareData.PrepareImportCoursewarePartData s);

    public abstract PrepareVideoData.PrepareVideoPointData convertVideoPointPart(PrepareImportVideoData.PrepareImportVideoPointData s);

    public abstract QuestionBaseDTO convertQuestion(QuestionImportDTO s);
}
